package shell.listener;

import inabit.base.WorkingMemory;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import shell.view.windows.NewExpressionWindow;
import shell.view.windows.NewRuleWindow;
/**@author Rafael Rocha*/
public class OpenExpressionWindowListener implements ActionListener{
	private NewRuleWindow parentWindow;
	private WorkingMemory wm;
	private int rulePart;
	
	public OpenExpressionWindowListener(NewRuleWindow parentWindow, WorkingMemory wm, int rulePart) {
		this.parentWindow = parentWindow;
		this.wm = wm;
		this.rulePart = rulePart;
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		NewExpressionWindow window = new NewExpressionWindow(parentWindow, wm, rulePart);
		window.setConective(parentWindow.getExpression(rulePart) != null);
		window.open();
		
	}
	
}
